from flask import Flask, jsonify, request
from flask_cors import CORS

app = Flask(__name__)
CORS(app, supports_credentials=True)

@app.route("/data",methods=['GET'])
def data():
    products = [
	    {"name": "香蕉", "price": 20},
	    {"name": "桔子", "price": 21},
	    {"name": "橙子", "price": 23},
    ]
    return jsonify(products)

@app.route("/login",methods=['POST'])
def login():
    print(request.args.get('name'))
    name = request.args.get('name')
    password = request.args.get('password')
    if(name=='admin'and password=='admin'):
        return jsonify('success')
    else:
        return('false')
@app.route("/control",methods=["GET"])
def control():
    null = None
    data = [
    {
        "id": 3,
        "home_out_type": "卖房",
        "name": "王世钢",
        "id_card": "112233",
        "home_name": "王世钢的房子",
        "home_type": "三室一厅",
        "floor": "第三层/共七层",
        "elevator": "1",
        "area": "88.88m2",
        "decorate": "精装",
        "picture": "wife.png",
        "property": "私产",
        "toward": "朝南",
        "total_price": "10000刀",
        "rent_type": null,
        "unit_price": null,
        "rent_time": null,
        "rent_require": null,
        "home_situation": null,
        "home_verify": "未审核",
        "home_owner": "christina"
    },
    {
        "id": 4,
        "home_out_type": "卖房",
        "name": "222",
        "id_card": "112233",
        "home_name": "233的房子",
        "home_type": "三室一厅",
        "floor": "第三层/共七层",
        "elevator": "1",
        "area": "88.88m2",
        "decorate": "精装",
        "picture": "wife.png",
        "property": "私产",
        "toward": "朝南",
        "total_price": "10000刀",
        "rent_type": null,
        "unit_price": null,
        "rent_time": null,
        "rent_require": null,
        "home_situation": null,
        "home_verify": "未审核",
        "home_owner": "christina"
    },
    {
        "id": 5,
        "home_out_type": "卖房",
        "name": "1234",
        "id_card": "112233",
        "home_name": "huhuhu的房子",
        "home_type": "三室一厅",
        "floor": "第三层/共七层",
        "elevator": "0",
        "area": "88.88m2",
        "decorate": "精装",
        "picture": "wife.png",
        "property": "私产",
        "toward": "朝南",
        "total_price": "10000刀",
        "rent_type": null,
        "unit_price": null,
        "rent_time": null,
        "rent_require": null,
        "home_situation": null,
        "home_verify": "未审核",
        "home_owner": "christina"
    },
    {
        "id": 6,
        "home_out_type": "卖房",
        "name": "ooooo",
        "id_card": "112233",
        "home_name": "呼呼呼的房子",
        "home_type": "三室一厅",
        "floor": "第三层/共七层",
        "elevator": "0",
        "area": "88.88m2",
        "decorate": "精装",
        "picture": "wife.png",
        "property": "私产",
        "toward": "朝南",
        "total_price": "10000刀",
        "rent_type": null,
        "unit_price": null,
        "rent_time": null,
        "rent_require": null,
        "home_situation": null,
        "home_verify": "未审核",
        "home_owner": "christina"
    },
    {
        "id": 12,
        "home_out_type": "卖房",
        "name": "ooooo",
        "id_card": "112233",
        "home_name": "呼呼呼的房子",
        "home_type": "三室一厅",
        "floor": "第三层/共七层",
        "elevator": "0",
        "area": "88.88m2",
        "decorate": "精装",
        "picture": "wife.png",
        "property": "私产",
        "toward": "朝南",
        "total_price": "10000刀",
        "rent_type": null,
        "unit_price": null,
        "rent_time": null,
        "rent_require": null,
        "home_situation": null,
        "home_verify": "未审核",
        "home_owner": "christina"
    },
    {
        "id": 13,
        "home_out_type": "卖房",
        "name": "ooooo",
        "id_card": "112233",
        "home_name": "呼呼呼的房子",
        "home_type": "三室一厅",
        "floor": "第三层/共七层",
        "elevator": "0",
        "area": "88.88m2",
        "decorate": "精装",
        "picture": "wife.png",
        "property": "私产",
        "toward": "朝南",
        "total_price": "10000刀",
        "rent_type": null,
        "unit_price": null,
        "rent_time": null,
        "rent_require": null,
        "home_situation": null,
        "home_verify": "未审核",
        "home_owner": "christina"
    },
    {
        "id": 14,
        "home_out_type": "卖房",
        "name": "ooooo",
        "id_card": "112233",
        "home_name": "呼呼呼的房子",
        "home_type": "三室一厅",
        "floor": "第三层/共七层",
        "elevator": "0",
        "area": "88.88m2",
        "decorate": "精装",
        "picture": "wife.png",
        "property": "私产",
        "toward": "朝南",
        "total_price": "10000刀",
        "rent_type": null,
        "unit_price": null,
        "rent_time": null,
        "rent_require": null,
        "home_situation": null,
        "home_verify": "未审核",
        "home_owner": "christina"
    },
    {
        "id": 15,
        "home_out_type": "卖房",
        "name": "ooooo",
        "id_card": "112233",
        "home_name": "呼呼呼的房子",
        "home_type": "三室一厅",
        "floor": "第三层/共七层",
        "elevator": "0",
        "area": "88.88m2",
        "decorate": "精装",
        "picture": "wife.png",
        "property": "私产",
        "toward": "朝南",
        "total_price": "10000刀",
        "rent_type": null,
        "unit_price": null,
        "rent_time": null,
        "rent_require": null,
        "home_situation": null,
        "home_verify": "未审核",
        "home_owner": "christina"
    },
    {
        "id": 16,
        "home_out_type": "卖房",
        "name": "ooooo",
        "id_card": "112233",
        "home_name": "呼呼呼的房子",
        "home_type": "三室一厅",
        "floor": "第三层/共七层",
        "elevator": "0",
        "area": "88.88m2",
        "decorate": "精装",
        "picture": "wife.png",
        "property": "私产",
        "toward": "朝南",
        "total_price": "10000刀",
        "rent_type": null,
        "unit_price": null,
        "rent_time": null,
        "rent_require": null,
        "home_situation": null,
        "home_verify": "未审核",
        "home_owner": "christina"
    }
    ]
    return jsonify(data)

if __name__ == '__main__':
    app.run()
